#ifndef __RENDEROBJ_H__
#define __RENDEROBJ_H__

#include "../ObjImporter/ObjImporter.h"
#include "../ObjImporter/TextureImporter.h"
#include <gl\gl.h>												// Header File For The OpenGL32 Library
#include <gl\glu.h>												// Header File For The GLu32 Library
#include <gl\glaux.h>											// Header File For The GLaux Library
#include <string>
#include <map>
#include <iostream>
#include <cmath>

class RenderObj
{
public:
	static RenderObj* GetInstance()
	{
		if( m_pInstance == NULL )
		{
			m_pInstance = new RenderObj();
		}

		return m_pInstance;
	}

	~RenderObj();

	void ResetMaterials( const std::vector<std::string>& mats );
	void ClearResetMaterials();
	void SetSMat( const std::string& sMat_name );
	void Paint( const std::string &obj_name );
	void SetRenderMode( int mode );
	void PrintCoor( float coor, GLfloat x, GLfloat y );

private:
	RenderObj();

	class Garbo
	{
	public:
		~Garbo()
		{
			if( RenderObj::m_pInstance != NULL )
			{
				delete RenderObj::m_pInstance;
			}
		}

		static Garbo garbo;
	};

	static RenderObj*	m_pInstance;

	int m_RenderMode;	// 0 3D mode
						// 1 2D mode

	std::string										m_SMat;
	std::vector<std::string>						m_resetMaterials;
	std::map<std::string, ObjImporter*>				m_ObjMap;
	std::map<std::string, ObjMatValues>				m_MatMap;
	std::map<std::string, std::vector<GLuint>>		m_ObjGenListMap;
	GLuint											m_Fontlists;

	bool LoadObj( const std::string &obj_name );
	bool ExistObj( const std::string &obj_name );
	ObjMatValues SetMat( const std::string& mat_name );
	void PaintUnitCube();
	void PaintUnitSpere();
	void PaintUnitCylinder();
	void PaintCapsule();
	void PaintAccessory( const std::string& obj_name, const std::string& mat_name );
	std::string GetMatNum( const std::string& mat_name );
	void PrintMsg( const std::string& msg, GLfloat x, GLfloat y );
	void BuildGenList( const std::string& obj_name );
};

#endif //__RENDEROBJ_H__